package org.jeecg.modules.report.service;


import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.report.vo.BaseProject;
import org.jeecg.modules.report.vo.RepairReport;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * @Description: 工程报修、投诉模块
 * @Author: liur
 * @Date:   2019-08-18
 * @Version: V1.0
 */
@FeignClient(value = "CIM-PROJECT",fallbackFactory = IProjectDataService.BaseDataClientFallBackFactory.class)
public interface IProjectDataService {

	@RequestMapping(value = "/api/repair/getRepairReport",method = RequestMethod.POST)
	RepairReport getRepairReport(@RequestParam("projectId") String projectId, @RequestHeader("tenantId") String tenantId);

	@Slf4j
	@Component
	class BaseDataClientFallBackFactory implements FallbackFactory<IProjectDataService> {
		@Override
		public IProjectDataService create(Throwable throwable) {
			return new IProjectDataService(){
					@Override
					public RepairReport getRepairReport(String projectId, String tenantId) {
					return new RepairReport("调用出错");
				}
			};
		}


	}

}
